import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { inspectionTaskVO, inspectionTaskForm, inspectionTaskQuery } from '@/api/inspection/inspection-task/types';

/**
 * 查询巡检-任务列表
 * @param query
 * @returns {*}
 */

export const listinspectionTask = (query?: inspectionTaskQuery): AxiosPromise<inspectionTaskVO[]> => {
  return request({
    url: '/inspection/inspection-task/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询巡检-任务详细
 * @param patrolInspectionTaskId
 */
export const getinspectionTask = (patrolInspectionTaskId: string | number): AxiosPromise<inspectionTaskVO> => {
  return request({
    url: '/inspection/inspection-task/' + patrolInspectionTaskId,
    method: 'get'
  });
};

/**
 * 新增巡检-任务
 * @param data
 */
export const addinspectionTask = (data: inspectionTaskForm) => {
  return request({
    url: '/inspection/inspection-task',
    method: 'post',
    data: data
  });
};

/**
 * 修改巡检-任务
 * @param data
 */
export const updateinspectionTask = (data: inspectionTaskForm) => {
  return request({
    url: '/inspection/inspection-task',
    method: 'put',
    data: data
  });
};

/**
 * 删除巡检-任务
 * @param patrolInspectionTaskId
 */
export const delinspectionTask = (patrolInspectionTaskId: string | number | Array<string | number>) => {
  return request({
    url: '/inspection/inspection-task/' + patrolInspectionTaskId,
    method: 'delete'
  });
};
